package cn.iocoder.yudao.module.dlbz.dal.mysql.supplier;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.dlbz.dal.dataobject.supplier.SupplierDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.dlbz.controller.admin.supplier.vo.*;

/**
 * 供应商管理 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface SupplierMapper extends BaseMapperX<SupplierDO> {

    default PageResult<SupplierDO> selectPage(SupplierPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<SupplierDO>()
                .likeIfPresent(SupplierDO::getName, reqVO.getName())
                .eqIfPresent(SupplierDO::getAddr, reqVO.getAddr())
                .likeIfPresent(SupplierDO::getContactName, reqVO.getContactName())
                .eqIfPresent(SupplierDO::getContactPhone, reqVO.getContactPhone())
                .eqIfPresent(SupplierDO::getBankAccount, reqVO.getBankAccount())
                .likeIfPresent(SupplierDO::getBankName, reqVO.getBankName())
                .eqIfPresent(SupplierDO::getBankNumber, reqVO.getBankNumber())
                .eqIfPresent(SupplierDO::getImgs, reqVO.getImgs())
                .eqIfPresent(SupplierDO::getVideoUrl, reqVO.getVideoUrl())
                .eqIfPresent(SupplierDO::getApproveState, reqVO.getApproveState())
                .eqIfPresent(SupplierDO::getIntro, reqVO.getIntro())
                .betweenIfPresent(SupplierDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(SupplierDO::getId));
    }

}